Wiki

Clone wiki

atlasboard / Atlasboard Authentication

When you create your first dashboard, you will start with an empty globalAuth.json

There is a globalAuth.json.sample file that should give you some hints about how to build your own: You can have two credential entries like this:

#!javascript

{
    "JIRA":{
        "username":"atlasuser",
        "password":"${ATLASUSER_PASS}"
    }, "twitter":{
        "username":"atlasboardpro",
        "password":"turing"
    }
}

Notice how you can use variables in the values. These variables will be sourced from the environment. The format for variable substitution must be ${VAR_NAME} and is case sensitive.

Easily use them in your job, like this:

#!javascript

    "confluence-blockers" : {
      "timeout": 30000,
      "authName" : "JIRA",
      "retryOnErrorTimes" : 3,
      "interval" : 120000,
      "jira_server" : "https://jira.atlassian.com",
      "useComponentAsTeam" : true,
      "projectTeams": {
        "CONFDEV": "Teamless Issue",
        "CONFVN": "Vietnam"
      },
      "highLightTeams" : ["Editor"]    
      "jql" : "(project in (\"CONFDEV\",\"CONFVN\") AND resolution = EMPTY AND priority = Blocker) OR (project = \"CONF\" AND resolution = EMPTY AND priority = Blocker AND labels in (\"ondemand\"))"
    },

In this particular case, the blockers job, will use the credentials defined in the "JIRA" global config key

#!javascript
// this is part of the blockers.js job
module.exports = function(config, dependencies, jobCallback) {

  // fallback to for configuration compatibility
  var authName = config.authName || 'jac';

  if (!config.globalAuth || !config.globalAuth[authName] ||
    !config.globalAuth[authName].username || !config.globalAuth[authName].password){
    return jobCallback('no credentials found in blockers job. Please check global authentication file (usually config.globalAuth)');
  }

  if (!config.jql || !config.jira_server){
    return jobCallback('missing parameters in blockers job');
  }

Updated